package net.comm.user.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.user.bean.BaseContacts;
import net.comm.user.bean.BaseDetails;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbDetailsService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  	userID = result.getInt(1);			//	会员ID
			String  nick = StringUtil.getValue(result.getString(2));			//	用户名
			String  name = StringUtil.getValue(result.getString(3));			//	真实姓名
			String  introduction = StringUtil.getValue(result.getString(4));	//	自我评价/个性签名
			int  	picID = result.getInt(5);									//	个人照片ID
			String  sex = StringUtil.getValue(result.getString(6));				//	性别
			String  work = StringUtil.getValue(result.getString(7));				//	目前职业
			String  workSet = StringUtil.getValue(result.getString(8));			//	职业隐私保护
			String  skill = StringUtil.getValue(result.getString(9));			//	特长
			String  skillSet = StringUtil.getValue(result.getString(10));		//	特长隐私保护
			String  birthday = StringUtil.getValue(result.getString(11));		//	出生日期
			String  birthdaySet = StringUtil.getValue(result.getString(12));	//	出生日期隐私保护
			String  star = StringUtil.getValue(result.getString(13));			//	星座
			String  chzodiac = StringUtil.getValue(result.getString(14));		//	生肖
			int  nationality = result.getInt(15);								//	国籍
			int  pepole = result.getInt(16);										//	民族
			int  polity = result.getInt(17);										//	政治面貌
			String  joinWorkTime = StringUtil.getValue(result.getString(18));		//	参加工作时间
			int  home_location = result.getInt(19);			//	户口省份
			int  home_sublocation = result.getInt(20);		//	户口城市
			int  home_area = result.getInt(21);				//	户口区县
			String  home_town = StringUtil.getValue(result.getString(22));			//	户口镇（街道）
			String  home_Set = StringUtil.getValue(result.getString(23));		//	户口所在地隐私保护
			String  certtype = StringUtil.getValue(result.getString(24));			//	证件类型
			String  certno = StringUtil.getValue(result.getString(25));			//	证件号码
			String  certSet = StringUtil.getValue(result.getString(26));		//	证件隐私保护
			String  marriage = StringUtil.getValue(result.getString(27));		//	婚姻状况
			String  isArmy = StringUtil.getValue(result.getString(28));			//	服役
			int  army = result.getInt(29);			//	服役
			String  armySet = StringUtil.getValue(result.getString(30));		//	服役隐私保护
			int  education = result.getInt(31);									//	学历
			String  highSchool = StringUtil.getValue(result.getString(32));		//	毕业中学
			String  hsFinshDate = StringUtil.getValue(result.getString(33));	//	中学毕业时间
			String  college = StringUtil.getValue(result.getString(34));		//	毕业大学
			String  colFinshDate = StringUtil.getValue(result.getString(35));	//	大学毕业时间
			String  schoolSet = StringUtil.getValue(result.getString(36));		//	学校隐私保护
			String  interest = StringUtil.getValue(result.getString(37));		//	爱好关注
			String  interestSet = StringUtil.getValue(result.getString(38));	//	爱好隐私保护
			String  mtime = StringUtil.getValue(result.getString(39));			//	最后修改日期	
			String  schoolSet2 = StringUtil.getValue(result.getString(40));		//	学校隐私保护

			
			// create the Resource from these fields
			return new BaseDetails(  army,  armySet,  birthday,	 birthdaySet,  certSet,  certno,  certtype,
					 chzodiac,  colFinshDate,  college,	education,  highSchool,  home_Set, home_area,
					home_location, home_sublocation,  home_town, hsFinshDate,  interest,  interestSet,
					introduction,  isArmy,  joinWorkTime, marriage,  mtime,  name, nationality,
					 nick, pepole, picID, polity,  schoolSet, sex,  skill,  skillSet,  star, userID,
					 work,  workSet, schoolSet2);
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
